package com.yidu.DatelessManagement.controller;

import com.yidu.DatelessManagement.entity.InventoryStatistics;
import com.yidu.DatelessManagement.service.InventoryStatisticsService;
import com.yidu.InventoryManagement.entity.SecurityStock;
import com.yidu.SystemManagement.util.TimeUtil;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.HashMap;
import java.util.List;

/**
 * @author :yimeng
 * @date :2023/2/1  11:27
 * @description:some description
 */
@RestController
public class InventoryStatisticsController {
    @Resource
    private InventoryStatisticsService isService;

    //证券库存统计
    @RequestMapping("/selectInventory")
    private HashMap selectInventory(String dateTime,String invId){
        System.out.println("查询总数量的时间"+dateTime);
        System.out.println(invId);
        String fundId="159934";
        if(dateTime!=null && dateTime!=""){
            String s = TimeUtil.dateCalculationReduce(dateTime, -1);
            List<InventoryStatistics> inventoryStatistics = isService.selectInventoryStatistics(fundId,s, dateTime, invId);
            HashMap map = new HashMap();
            map.put("count",10);
            map.put("code",0);
            map.put("msg","");
            map.put("data",inventoryStatistics);
            return map;
        }else{
            List<InventoryStatistics> inventoryStatistics = isService.selectInventoryStatistics(fundId,"", dateTime, invId);
            HashMap map = new HashMap();
            map.put("count",10);
            map.put("code",0);
            map.put("msg","");
            map.put("data",inventoryStatistics);
            return map;
        }



    }

}
